/*
                    _____           _____
	\    / |     | |        |     |   |
	 \  /  |     | |—————   |     |   |
	  \/    \___/  |_____    \___/  __|__


		---- create by millent
			 github @jon-millent

			 @copy right
*/




;(function(Vue,root){
	//禁用滚动帮助
    root.ModalHelper = (function(bodyCls) {
        var scrollTop;
        return {
            afterOpen: function() {
                scrollTop = document.scrollingElement.scrollTop;
                document.body.classList.add(bodyCls);
                document.body.style.top = -scrollTop + 'px';
            },
            beforeClose: function() {
                document.body.classList.remove(bodyCls);
                // scrollTop lost after set position:fixed, restore it back.
                document.scrollingElement.scrollTop = scrollTop;
            }
        };
    })('modal-open');

	//格式化日期
	Date.prototype.Format = function (fmt) {
	    var o = {
		"M+": this.getMonth() + 1, //月份
		"d+": this.getDate(), //日
		"h+": this.getHours(), //小时
		"m+": this.getMinutes(), //分
		"s+": this.getSeconds(), //秒
		"q+": Math.floor((this.getMonth() + 3) / 3), //季度
		"S": this.getMilliseconds() //毫秒
	    };
	    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
	    for (var k in o)
		if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
	    return fmt;
	}
	Date.prototype.getFullTime = function(){
		return this.Format('yyyy-MM-dd hh:mm:ss');
	}
	//首字母大写
	String.prototype.firstUpperCase=function(){
	    return this.replace(/^\S/,function(s){return s.toUpperCase();});
	}
	//去空格
	String.prototype.isTrim = function(){
		return this.replace(/\s/g,'');
	}
	//空
	String.prototype.isEmpty = function(){
		return this.replace(/\s/g,'') == "";
	}
	//判断电话号码
	String.prototype.isPhoneNumber = function(){
		return /^1[34578]\d{9}$/.test(this);
	}
	//判断英文或者数字
	String.prototype.isEnglishAndNumber = function(){
		return !/^[a-z0-9][a-z\-\_0-9]+?[a-z0-9]$/i.test(this);
	}
	root.toEmpty = function(objs){
		for(var i in objs){
			objs[i] = "";
		}
	}

	Date.prototype.getNormalTime = function(){
		return new Date().Format('yyyy-MM-ddThh:mm:ss');
	}


	//禁用浏览器 F12
    document.onkeydown = function (e) {
        var currentKey = 0, k = e || window.event;
        currentKey = k.keyCode || k.which || k.charCode;
        if (currentKey == 123) {
            window.event.cancelBubble = true;
            window.event.returnValue = false;
        }
    }
    document.oncontextmenu = function () {
        return false;
    }


    var STOPMOVE = function(e){e.preventDefault();};

	// 公用的 rose util tool
	root.rose = {

		getUrl : baseUrl,

		util : {
			stopScroll : function(){
				document.body.style.overflow='hidden';
			},
			runScroll : function(){

                document.body.style.overflow='';
			},
			addHash: function () {

				// exit if the browser implements that event
				if ("onhashchange" in window) { return; }

				var location = window.location,
					oldURL = location.href,
					oldHash = location.hash;

				// check the location hash on a 100ms interval
				setInterval(function() {
					var newURL = location.href,
						newHash = location.hash;

					// if the hash has changed and a handler has been bound...
					if (newHash != oldHash && typeof window.onhashchange === "function") {
						// execute the handler
						window.onhashchange({
							type: "hashchange",
							oldURL: oldURL,
							newURL: newURL
						});

						oldURL = newURL;
						oldHash = newHash;
					}
				}, 100);

            },
			getReauest : function() {
			   var url = location.search; //获取url中"?"符后的字串
			   var theRequest = new Object();
			   if (url.indexOf("?") != -1) {
			      var str = url.substr(1);
			      strs = str.split("&");
			      for(var i = 0; i < strs.length; i ++) {
			         theRequest[strs[i].split("=")[0]]=decodeURIComponent(strs[i].split("=")[1]);
			      }
			   }
			   return theRequest;
		   },
		   getStates : [
			   {
			   		name : "全部"
		   	   },{
			   		name : "等待生产",
					code : 0
		   	   },{
			   		name : "正在生产",
					code : 1
		   	   },{
				   name : "暂停",
				   code : 2
			   },{
				   name : "完成",
				   code : 3
			   },{
				   name : "删除",
				   code : 4
			   }
	   		],
			getJavaTime: function (str) {
				return this.getPhoneTime(str)
            },
			getH5Time: function (str) {
				return str ? new Date(str.time).Format('yyyy-MM-ddThh:mm') : '';
    		},
            getH5Time1: function (str) {
                return str ? new Date(str.time).Format('yyyy-MM-dd') : '';
            },
			setItem:function (key,value) {
				if(window.localStorage){
					window.localStorage.setItem(key,value);
				}else{
					$.fn.cookie(key,value,{
                        path: '/',
                        expires : 10000000
                    });
				}
            },
			getItem:function (key) {
                if(window.localStorage){
                	return window.localStorage.getItem(key);
				}else{
                    return $.fn.cookie(key);
				}
            },
			removeItem:function (key) {
                if(window.localStorage){
                    window.localStorage.removeItem(key);
                }else{
					$.fn.cookie(key,'',{
                        path: '/',
                        expires : -10000000
                    });
                }
            },
            getIndexDay : function(AddDayCount) {
                function getDateStr(dayCount){
                    if(null == dayCount){
                        dayCount = 0;
                    }
                    var dd = new Date();
                    dd.setDate(dd.getDate()+dayCount);//设置日期
                    var y = dd.getFullYear();
                    var m = dd.getMonth()+1;//获取当前月份的日期
                    var d = dd.getDate();

                    dd.setHours(0);
                    dd.setMinutes(0);
                    dd.setSeconds(0);

                    return dd
                }
                // var dd = new Date();
				// dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
				// var y = dd.getFullYear();
				// var m = dd.getMonth()+1;//获取当前月份的日期
				// var d = dd.getDate();
				return  new Date(getDateStr(AddDayCount)).Format('yyyy-MM-dd hh:mm:ss');
			},
			getPhoneTime: function (str) {

				var t = str.replace(/[T|+]/,' ') || '';
				var sub = t.indexOf('.');

				if(sub != -1){
					t = t.substr(0,sub);
				}

				return t || '';

            },
			getTodayBeginTime: function () {
				return this.getIndexDay(0)
            },
			getTodayEndTime: function () {
                function getDateStr(dayCount){
                    if(null == dayCount){
                        dayCount = 0;
                    }
                    var dd = new Date();
                    dd.setDate(dd.getDate()+dayCount);//设置日期
                    var y = dd.getFullYear();
                    var m = dd.getMonth()+1;//获取当前月份的日期
                    var d = dd.getDate();

                    dd.setHours(23);
                    dd.setMinutes(59);
                    dd.setSeconds(59);

                    return dd
                }
                // var dd = new Date();
                // dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
                // var y = dd.getFullYear();
                // var m = dd.getMonth()+1;//获取当前月份的日期
                // var d = dd.getDate();

                return  new Date(getDateStr()).Format('yyyy-MM-dd hh:mm:ss');
            },



            getMengTime: function (index, type) {
                function getDateStr(dayCount){
                    if(null == dayCount){
                        dayCount = 0;
                    }
                    var dd = new Date();
                    dd.setDate(dd.getDate()+dayCount);//设置日期
                    var y = dd.getFullYear();
                    var m = dd.getMonth()+1;//获取当前月份的日期
                    var d = dd.getDate();

                    dd.setHours(23);
                    dd.setMinutes(59);
                    dd.setSeconds(59);

                    return dd
                }
                // var dd = new Date();
                // dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
                // var y = dd.getFullYear();
                // var m = dd.getMonth()+1;//获取当前月份的日期
                // var d = dd.getDate();
                var conStr = ''
                if(!type){
                    conStr = '00:00:00'
				}else{
                    conStr = '23:59:59'
				}

                return  new Date(getDateStr(index)).Format('yyyy-MM-dd '+conStr);
            }

		}
	};

	/* fucos 指令 */
	// Vue.directive('focus', function(el, binding) {
	// 	if(binding){
	// 		el.focus();
	// 	}
	// })

	// <button v-bind:quanxian="/ssss/login"></button>


	//debug 用 一会删

    // window.getApi = function () {
		// var g = []
    //     var item = JSON.parse(localStorage.getItem('api')) || JSON.parse($.fn.cookie('api') || '[]') || [];
    //     for(var i=0; i<item.length; i++){
    //         g.push(item[i].url+' : '+item[i].api);
    //     }
    //     console.log(g)
    // }

	/* 权限 指令 为某些按钮 特定功能准备 */
    Vue.directive('quanxian', function(el, binding) {
        var item = [];
        if(window.localStorage){
            item = JSON.parse(localStorage.getItem('api') || '[]');
		}else{
            item = JSON.parse($.fn.cookie('api') || '[]') ;
		}

		var has = false;
        for(var i=0; i<item.length; i++){
    		if(item[i].api == binding.value || (item[i].url ==  binding.value && item[i].api != '')){
    			has = true;
			}

		}
        if(!has){
        	var cls = 'quanxina-jinyong';

        	if(el.className.indexOf(cls) == -1){
                el.className += (el.className== '' ? cls : ' '+cls);
			}


            el.disabled = true;
			try{
                var old_element = el;
                var new_element = old_element.cloneNode(true);
                old_element.parentNode.replaceChild(new_element, old_element);
			}catch(e){}
		}
    })
	/* 权限 指令 为列表准备 是否能点击 返回布尔值 */
	rose.util.quanxian = Vue.prototype.quanxian= function (quanxian) {
        var item = [];
        if(window.localStorage){
            item = JSON.parse(localStorage.getItem('api') || '[]');
        }else{
            item = JSON.parse($.fn.cookie('api') || '[]') ;
        }

        var has = false;
        for(var i=0; i<item.length; i++){
            if(item[i].api == quanxian || (item[i].url ==  quanxian && item[i].api != '')){
                has = true;
                // console.log(item[i].api,binding.value)
            }
        }
        return has;
    }


	//内部代码使用的公共工具
	window.ToolList = {
		backBoolean : function(obj){
			if(typeof obj == 'string'){
				return obj == "true" ? true : false
			}
			return obj
		},
		extends : function(a,b){
			for(var i in b){
				a[i] = b[i]
			}

			return a;
		},
		setTransform : function(obj,key,value){
			var bower = ['moz','ms','o','webkit',''];

			for(var i=0; i<bower.length; i++){
				if(bower[i] != ''){
					obj.style[bower[i]+key.firstUpperCase()] = value;
				}else{
					obj.style[key] = value;
				}

			}
		}
	};


	/*
		顶部导航栏组件 create by hsh
		使用 :

			<title-header back="show" title="常见">
				<button class="ui-btn-cursor">xxxx</button>
			</title-header>

			说明 :
				back : (选传|string) 表示是否显示返回键 true 显示 不写或为false不显示 非双向绑定
					例子 : <title-header back="true" title="常见"></title-header>


				v-bind:back : back (选传|boolean) 双向绑定形式  显示返回键 true 显示 不写或为false不显示
					例子 : <title-header v-bind:back="back" title="常见"></title-header>


				title : (选传|string) 标题名称 默认为 标题 非双向绑定


				v-bind:title (选传|string) 双向绑定的标题


				插值 : (选传|dom-ement) 插入到的自定义按钮 例如 <button class="ui-btn">返回</button>


	*/


	Vue.component('title-header',{
		props : {
			title : {
				type : String,
				default : '标题'
			},
			back : {
				default : false
			},
			titleback : {
				default : false
			},
			backurl : {
				default: false
			}
		},
		computed : {
			backShow : function(){
				return ToolList.backBoolean(this.back);
			},
			titleBack : function(){

				if(this.titleback){
					return function(){
						history.back()
					}
				}
			}
		},
		methods: {
			backer: function () {
				if(this.backurl){
					location.href = this.backurl
				}else{
                    history.back()
				}
            }
		},
		template :
			'<header class="ui-header ui-header-positive ui-border-b">\
	            <i class="iconfont icon-back" v-show="backShow" @click="backer"></i>\
	            <h1><span @click="titleBack" v-html="title"></span></h1>\
	            <div class="ui-btn"><slot><slot></div>\
	        </header>'
	})




	/*
		加载更多组件

		使用
			<load-more></load-more>

			 api : api方法名
			 success ： 成功后的回掉
			 error : 失败后的回掉
			 json : 传参数
	 		 listen : 监听自定义父元素，默认window,要监听父元素，传一个父元素下的子元素的id值即可

			 <load-more api="spQuerySimpleContract" v-on:success="loadsuccess"></load-more>

			 <load-more api="spQuerySimpleContract" listen="mycontent01" v-on:success="loadsuccess"></load-more>

			 <load-more api="spQuerySimpleContract" listen="mycontent01" v-on:success="loadsuccess" :json="json"></load-more>
	*/
	Vue.component('load-more',{
		props : {
			listen : { //监听的盒子id ， 不传默认是window
				default : false
			},
			listenning : { //是否监听
				default : true
			},
			api : {
				default : ""
			},
			json : {

			},
            pagesize: {
				default: 10
			}
		},
		computed : {

		},
		data : function(){
			return {
				loadIndex : 0,
				config : {
					currPage : 0,
					PageSize : 10
				},
				once : true,
				cansend : true,

				loaded : false,

				loadText : "加载更多"
			}
		},
		watch : {
			json : function(){
				var root = this;
				root.cansend = true;

				function extender(p,c){
					var g = {};


					for(var i in p){
						g[i] = p[i];
					}

					for(var i in c){
						g[i] = c[i];
					}

					return g;
				}
				root.config.currPage = 0;
				root.loaded = true;



				// console.log(root.json[root.json.length-1],root.config,'test')


				API[root.api](extender(root.config,root.json[root.json.length-1] || {}),function(data){

					if(data.pageBean && data.pageBean.pageCount != 'undefined'){
                        root.$emit('success',data,true);
                        // console.log(root.config.currPage , data.pageBean.pageCount, "{{{{{{{")

                        if(root.config.currPage+1 >= data.pageBean.pageCount){
                            root.cansend = false;
                            root.loadText = "没有更多数据了"
                        }else{
                            root.loadText = "加载更多"
                        }

                        root.loaded = false;
                        root.loadIndex = 0;
					}else{
                        root.loadText = data.msg || "获取数据失败";
                        root.cansend = false;
                        root.loaded = false;
                        root.$emit('error',data,true);
					}

				},function(data){
					root.loadText = "网络连接错误";
					root.cansend = false;
					root.loaded = false;
                    root.$emit('error',data,true);
				})
			}
		},
		mounted : function(){


			this.config.PageSize = parseInt(this.pagesize) || 10; //让组件传pagesize

			if(this.listen){
				this.ele =  document.getElementById(this.listen).parentNode;
			}else{
				this.ele = window;
			}
			var root = this;



			function getTop(){
				if(root.listen){
					return root.ele.scrollTop + root.ele.clientHeight;
				}else{
					return (document.documentElement.scrollTop || document.body.scrollTop)+document.documentElement.clientHeight;
				}

			}
			function getScrollHeight(){
				if(root.listen){
					return root.ele.scrollHeight-10;
				}else{
					return document.documentElement.scrollHeight-10;
				}
			}
			function extender(p,c){
				var g = {};


				for(var i in p){
					g[i] = p[i];
				}

				for(var i in c){
					g[i] = c[i];
				}

				return g;
			}


			var root = this;



			//默认请求一次
			if(this.once){
				root.loaded = true;

				API[this.api](extender(root.config,root.json ? root.json[root.json.length-1] : {}),function(data){
                    if(data.pageBean && data.pageBean.pageCount != 'undefined'){
                        root.$emit('success',data);
                        root.loaded = false;
                        if(root.config.currPage+1 >= data.pageBean.pageCount){
                            root.cansend = false;
                            root.loadText = "没有更多数据了"
                        }
					}else{
                        root.$emit('error',data);

                        root.loadText = data.msg || "获取数据失败";
                        root.cansend = false;
                        root.loaded = false;
					}



				},function(data){
					root.$emit('error',data);

					root.loadText = "网络连接错误";
					root.cansend = false;
					root.loaded = false;


				})
				this.once = false;
			}

			//添加监视
			this.ele.addEventListener('scroll',function(){


				if( getTop() >= getScrollHeight() && root.cansend){
					root.loadIndex++;
					if(root.loadIndex==1){

						root.config.currPage++;
						root.loaded = true;


						API[root.api](extender(root.config,root.json ? root.json[root.json.length-1] : {}),function(data){

                            if(data.pageBean && data.pageBean.pageCount != 'undefined'){
                                root.$emit('success',data);

                                if(root.config.currPage >= data.pageBean.pageCount){
                                    root.cansend = false;
                                    root.loadText = "没有更多数据了"
                                }

                                root.loaded = false;
                                root.loadIndex = 0;
							}else{
                                root.$emit('error',data);
                                root.loadText = data.msg || "网络连接错误";
                                root.cansend = false;
							}


						},function(){
							root.$emit('error',data);
							root.loadText = "网络连接错误";
							root.cansend = false;
						})

					}
				}
			})
		},
		template : '\
			<div class="load-more">\
				<div class="loading">\
					<p style="display:none;" v-show="!loaded" v-html="loadText">\</p>\
					<p v-show="loaded">加载中<span class="iconfont icon-jiazai"></span>\</p>\
				</div>\
			</div>\
			'

	})


	/*
		底部导航栏组件

		使用
			<ui-footer></ui-footer>
	*/
	Vue.component('ui-footer',{
		props : {
			active : {
				default : 0
			}
		},
		data : function(){
			return {
				data : [

					{
						title : '主页',
						icon : 'icon-zhuye',
						link : 'index.html'
					},
					{
						title : '消息',
						icon : 'icon-xiaoxi',
						link : 'message.html'
					},
					{
						title : '个人',
						icon : 'icon-geren',
						link : 'myself.html'
					}

				]
			}
		},
		computed : {
			getActive : function(){
				return function(index){
					return parseInt(this.active) == index;
				}
			}
		},
		template : '\
			<footer class="ui-footer ui-footer-stable ui-border-t">\
			    <ul class="ui-tiled">\
			        <li v-bind:class="{active : getActive(index)}" v-for="(value,index) in data">\
			        	<a v-bind:href="value.link" class="footer-item">\
			        		<span class="iconfont" v-bind:class="value.icon"></span>\
			        		<i v-html="value.title"></i>	\
			        	</a>\
			        </li>\
			    </ul>\
			</footer>\
			'

	})




	/*  */



	/*
		左侧栏组件

		使用
			<slider-box v-bind:show="show" v-on:change="change"></slider-box>

			show : "显示隐藏的状态"

			change : function(value){ //用来唤醒状态
				this.show = value;
			}
	*/
	Vue.component('slider-box',{
		props : {
			show : {
				default : false
			}
		},
		data : function(){
			return {
				data : [
					[
						{
							title : "销售管理",
							link : "work.html?index=0",
							icon : "icon-xiaoshou",
							quanxian : 'work.html?index=0'
						},
						{
							title : "统计管理",
							link : "work.html?index=1",
							icon : "icon-tiaodu",
                            quanxian : 'work.html?index=1'
						},
						{
							title : "生产管理",
							link : "work.html?index=2",
							icon : "icon-shengchanxian",
                            quanxian : 'work.html?index=2'
						},
						{
							title : "物料管理",
							link : "work.html?index=3",
							icon : "icon-wuliaoguanli",
                            quanxian : 'work.html?index=3'
						}
					],
					[
                        {
                            title : "修改密码",
                            link : "editpassword.html",
                            icon : "icon-dengji",
                            login : true
                        },
						{
							title : "问题反馈",
							link : "simplecontrac/fankui.html",
							icon : "icon-wentifankui",
                            quanxian : '1'
						},
						{
							title : "产品信息",
							link : "simplecontrac/about-erp.html",
							icon : "icon-ziliao",
                            quanxian : '1'
						},
						{
							title : "关于砼鑫",
							link : "about-us.html",
							icon : "icon-lianjie",
                            quanxian : '1'
						}
					]

				],
				opacity : 0,
				left : '0',
				display : 'none',
				myIndexHref : rose.getUrl + "menu.html"
			}
		},
		watch : {
			show : function(value){
				var root = this;
				if(!value){
					this.opacity = '0';
					setTimeout(function(){
						root.display = 'none';
					},280)

				}else{
					this.display = 'block';
					setTimeout(function(){
						root.opacity = '.8';
					},50)
				}
			}
		},
		methods : {
			linkgo : function(link){
				document.location.href = rose.getUrl+link;
			},
			menushow : function() {
				this.show = !this.show;
				this.$emit('change',this.show);
				//./images/1c524da6.bookkeeper.png
			},
			closeshow : function() {
				this.show = false;
				this.$emit('change',this.show);
				//./images/1c524da6.bookkeeper.png
			},
			quit : function(){

                // $.fn.cookie('compid','',config);
                // $.fn.cookie('opid','',config);
                // $.fn.cookie('token','',config);
				if(window.localStorage){
                    localStorage.removeItem('compid');
                    localStorage.removeItem('opid');
                    localStorage.removeItem('token');
                    localStorage.removeItem('empname');
                    localStorage.removeItem('api');
                    localStorage.removeItem('shortname');
                    localStorage.removeItem('t_username');
                    localStorage.removeItem('t_password');
                    localStorage.removeItem('userface');

				}else{
                    var config = {
                        path: '/',
                        expires : -10000000
                    }

                    $.fn.cookie('opid','',config);
                    $.fn.cookie('token','',config);
                    $.fn.cookie('empname','',config);
                    $.fn.cookie('api','',config);
                    $.fn.cookie('shortname','',config);
                    $.fn.cookie('t_username','',config);
                    $.fn.cookie('t_password','',config);
                    $.fn.cookie('userface','',config);
				}



				this.openPage(rose.getUrl + 'login1.html');
			},
            editFace: function () {
				this.openPage(rose.getUrl + 'edituserface.html')
            },
			clearChaChe: function () {

				var su = true;
				try{
                    javascritp:tool.clearCache();
				}catch(e){
                    su = false;
				}

				// this.console.log(su ? "清理成功" : "清理失败");

            }
		},
		computed : {
			getFace : function(){
				return rose.util.getItem('userface') || rose.getUrl+"images/1c524da6.bookkeeper.png"
			},
			getUserName : function () {
				return rose.util.getItem('empname') || "未登录";
            },
			getShortName : function () {
				return (rose.util.getItem('shortname') || "").replace('"','').replace('"','') || '';
            },
			clearChaCheIsShow : function () {
				return this.isAPP();
            },
            getLog: function () {
				return function (x) {
					if(x.login){
						return this.getShortName
					}
					return false;
                }
            }
		},
		template : '\
				<div>\
					<div class="object-box" v-on:touchstart="closeshow" v-bind:style="{opacity:opacity,left:left,display:display}">\
					</div>\
					<div class="slider-box" v-bind:class="{shower : show}">\
						<div class="user-face-box">\
							<img :src="getFace" @click="editFace" alt="用户头像">\
							<p>{{getUserName}}</p>\
							<span class="user-name">{{getShortName}}</span>\
						</div>\
						<div class="slider-menu-item" v-for="first in data">\
							<div class="slider-object-item btn-active" v-for="second in first" v-if="second.quanxian == 1 || quanxian(second.quanxian) || getLog(second)" v-on:click="linkgo(second.link)">\
								<span class="iconfont left-icon" v-bind:class="second.icon"></span>\
								<span class="item-name" v-html="second.title"></span>\
								<span class="iconfont icon-arrow-right tips"></span>\
							</div>\
						</div>\
						<div class="btns">\
							<a class="quiter" :href="myIndexHref">首页</a>\
							<a class="quiter" @click="quit" href="javascript:;">退出</a>\
						</div>\
						<div class="btns">\
							<a class="quiter" href="javascript:;" v-if="clearChaCheIsShow" @click="clearChaChe">清理缓存</a>\
						</div>\
					</div>\
				</div>\
			'

	})


	/*
		后台左侧栏组件

		使用
			<slider-box v-bind:show="show" v-on:change="change"></slider-box>

			show : "显示隐藏的状态"

			change : function(value){ //用来唤醒状态
				this.show = value;
			}
	*/
	Vue.component('slider-box-admin',{
		props : {
			show : {
				default : false
			}
		},
		data : function(){
			return {
				data : [
					[
						{
							title : "企业管理",
							link : "management.html#",
							icon : "icon-loufang"
						},
						{
							title : "用户管理",
							link : "management.html#",
							icon : "icon-gerenzhongxin-"
						},
						{
							title : "权限管理",
							link : "management.html#",
							icon : "icon-banshouline"
						}
					]

				],
				opacity : 0,
				left : '0',
				display : 'none',
				myIndexHref : rose.getUrl + "menu.html"
			}
		},
		watch : {
			show : function(value){
				var root = this;
				if(!value){
					this.opacity = '0';
					setTimeout(function(){
						root.display = 'none';
					},280)

				}else{
					this.display = 'block';
					setTimeout(function(){
						root.opacity = '.8';
					},50)
				}
			}
		},
		methods : {
			linkgo : function(link){
				document.location.href = rose.getUrl+link;
			},
			menushow : function() {
				this.show = !this.show;
				this.$emit('change',this.show);
				//./images/1c524da6.bookkeeper.png
			},
			closeshow : function() {
				this.show = false;
				this.$emit('change',this.show);
				//./images/1c524da6.bookkeeper.png
			},
			quit : function(){
                // var config = {
                //     path: '/',
                //     expires : -1000000
                // }
                // $.fn.cookie('compid','',config);
                // $.fn.cookie('opid','',config);
                // $.fn.cookie('token','',config);
                // localStorage.removeItem('compid');
                // localStorage.removeItem('opid');
                // localStorage.removeItem('token');
                // localStorage.removeItem('empname');
                // localStorage.removeItem('api');
                // STATES.lo
                if(window.localStorage){
                    localStorage.removeItem('compid');
                    localStorage.removeItem('opid');
                    localStorage.removeItem('token');
                    localStorage.removeItem('empname');
                    localStorage.removeItem('api');
                    localStorage.removeItem('shortname');
                    localStorage.removeItem('t_username');
                    localStorage.removeItem('t_password');
                    localStorage.removeItem('userface');


                }else{
                    var config = {
                        path: '/',
                        expires : -10000000
                    }

                    $.fn.cookie('opid','',config);
                    $.fn.cookie('token','',config);
                    $.fn.cookie('empname','',config);
                    $.fn.cookie('api','',config);
                    $.fn.cookie('shortname','',config);
                    $.fn.cookie('t_username','',config);
                    $.fn.cookie('t_password','',config);
                    $.fn.cookie('userface','',config);

                }

				this.openPage(rose.getUrl + 'login1.html');
			},
            editFace: function () {
                this.openPage(rose.getUrl + 'edituserface.html')
            }
		},
		computed : {
			getFace : function(){
				return rose.getUrl+"images/1c524da6.bookkeeper.png"
			},
            getUserName : function () {
                return localStorage.getItem('empname') || "未登录";
            }
		},
		template : '\
				<div>\
					<div class="object-box" v-on:touchstart="closeshow" v-bind:style="{opacity:opacity,left:left,display:display}">\
					</div>\
					<div class="slider-box admin-back-slider" v-bind:class="{shower : show}">\
						<div class="user-face-box">\
							<img :src="getFace" @click="editFace" alt="5.25/1.11111">\
							<p>{{getUserName}}</p>\
							<span class="user-name" style="display: none">河南砼鑫软件科技有限公司</span>\
						</div>\
						<div class="slider-menu-item" v-for="first in data">\
							<div class="slider-object-item btn-active" v-for="second in first" v-on:click="linkgo(second.link)">\
								<span class="iconfont left-icon" v-bind:class="second.icon"></span>\
								<span class="item-name" v-html="second.title"></span>\
								<span class="iconfont icon-arrow-right tips"></span>\
							</div>\
						</div>\
						<div class="btns">\
							<a class="setting"><span class="iconfont icon-artboard7" ></span>设置</a>\
						</div>\
					</div>\
				</div>\
			'

	})


	/* 搜索框组件 */

	/*

		使用
			<ui-search change="changeFunction" submit="submitFunction" placeholder="请输入"></ui-search>

			change : function(value){ // [ void function (string value) ]当值发生改变的时候 ， 接受改变的值

			}

			submit : function(value){ // [ void function (string value) ]当提交的时候 ， 接受改变的值

			}

			changeShow : function(value){ // [ void function (boolean value) ] 辅助双向绑定

			}

			placeholder : string // 改变默认提示

			foucs : boolean //默认是否搜索

	*/

	Vue.component('ui-search',{
		props : {
			placeholder : {
				default : "请输入"
			},
			change : {
				default : function(value){
					console.log('change',value)
				},
				type : Function
			},
			submit : {
				default : function(value){
					console.log('submit',value)
				},
				type : Function
			},
			changeShow : {
				default : function(){},
				type : Function
			},
			foucs : {
				default : false
			}
		},
		computed : {
			focusShow : function(){
				return ToolList.backBoolean(this.foucs);
			}
		},
		data : function(){
			return {
				text : ""
			}
		},
		methods : {
			toggleClass : function(){
				this.foucs = true;
			},
			toggleCancel : function(){
				this.foucs = false;
				this.changeShow(this.foucs);
			},
			clearText : function(){
				this.foucs = true;
				this.text = "";
			},
			changeValue : function(e){
				if(e.keyCode != 13){
					this.change(this.text);
				}else{
					this.submit(this.text);
				}
			}
		},
		template : '\
				<div class="ui-searchbar-wrap ui-border-b" :class="{focus : focusShow}">\
		            <div class="ui-searchbar ui-border-radius" @click="toggleClass">\
		                <i class="ui-icon-search"></i>\
		                <div class="ui-searchbar-text">{{placeholder}}</div>\
		                <div class="ui-searchbar-input"><input value="" type="tel" v-on:keyup="changeValue(event)" v-bind:placeholder="placeholder" v-model="text" v-focus="focusShow" autocapitalize="off"></div>\
		                <i class="ui-icon-close" v-on:click="clearText()"></i>\
		            </div>\
		            <button class="ui-searchbar-cancel" v-on:click="toggleCancel()">取消<tton>\
		        </div>\
			    '

	})


	/* 筛选框组件 */

	/*

		<ui-filter v-bind:data="json" v-bind:change="change"></ui-filter>

		data : [ //筛选框数据
			name : string,
			children : [
				name : string
			]
		]

		change : function //当用户点击数据改变时候 ()

		cancel : function //当用户点击取消时候 ()

		submit : function //当用户点击确认的时候 ()

		this.filterOpen(); //打开筛选框

		this.filterClose(); //关闭筛选框

	*/

	Vue.component('ui-filter',{
		props : {
			data : {
				default : []
			},
			change : {
				default : function(){},
				type : Function
			},
			cancel : {
				default : function(){},
				type : Function
			},
			submit : {
				default : function(){},
				type : Function
			},
			close : {
				default : false,
				type : Boolean
			}

		},
		computed : {
			nowSelect : function(){
				return this.data[this.index].children;
			},
			activeShow : function(){
				return function(index){
					return this.data[this.index].children[index].checked ? "active" : ""
				}
			}
		},
		data : function(){
			return {
				text : "",
				index : 0,
				activeer : 0,
				erdata : [],
				id1 : "scroll"+new Date().getTime(),
				id2 : "scrol2"+new Date().getTime(),
				activeBox : [],

				issearch : false, //是否开启查询4
				intime : false, //开启时间查询5
				inscroll : false, //开启后台查询添加筛选条件

				nowRotate : 0,//现在的旋转度数

				nowinput : "",
				nowinputtime : "",
				nowajaxsearch : "",


				//分页数据
				pageData : {
					currPage : 0,
					PageSize : 10
				},

				//显示加载中
				isLoading : false,
				loadingText : "加载中...",
				toLoading : false //图标状态
			}
		},
		watch : {
			erdata : {
				handler : function(){
					var root = this;
					setTimeout(function(){
						root.myScroll2.refresh();
					},1)
				},
				deep : true
			},
			close : function(value){

				if(!value){
					/*
					for(var i=0; i<this.data.length; i++){
						for(var j=0; j<this.data[i].children.length; j++){
							this.data[i].children[j].checked = false;
						}
					}

					//重置默认值
					this.index = 0;
					this.erdata = this.data[0].children;
					this.activeer = 0;
					this.scrollTop = 0;
					this.activeBox = [];
					this.issearch = false;
					this.intime = false;

					if(this.data[0].input){
						this.issearch = true;
					}else{
						this.issearch = false;
					}

					if(this.data[0].intime){
						this.intime = true;
					}else{
						this.intime = false;
					}

					if(this.data[0].inscroll){
						this.inscroll = true;
					}else{
						this.inscroll = false;
					}
					this.myScroll1.scrollTo(0,0,0);
					this.myScroll2.scrollTo(0,0,0);

					*/
				}

			}
		},
		methods : {
			changeMethods : function(index){
				//当值发生改变的时候做出相应
				this.index = index;
				this.change(this.data[this.index],this.activeer);
				this.erdata = this.data[this.index].children;
				this.activeer = 0;

				if(this.data[this.index].input){
					this.issearch = true;
				}else{
					this.issearch = false;
				}

				if(this.data[this.index].intime){
					this.intime = true;
				}else{
					this.intime = false;
				}

				if(this.data[this.index].inscroll){
					this.inscroll = true;

					if(!this.data[this.index].pageData){
						this.data[this.index].pageData = {
							currPage : 0,
							PageSize : 10
						}
					}

				}else{
					this.inscroll = false;
				}





				this.erdata = this.data[this.index].children;
				var root = this;

				if(this.data[this.index].pageData && this.data[this.index].pageData.currPage == 0){
					API[this.data[this.index].api](this.data[this.index].pageData,function(data){

						if(data.code == 0){
							for(var i=0; i<data.data[0].length; i++){
								root.data[root.index].children.push({
									name : data.data[0][i][root.data[root.index].key]
								});
							}

							if(data.pageBean.pageCurr+1 >= data.pageBean.pageCount){
								root.data[root.index].loadingText = "没有更多数据了";
								root.data[root.index].toLoading = false;
								root.data[root.index].inscroll = false;
							}else{
								root.data[root.index].isLoading = false;
							}

						}else{
							root.isLoading = false;
							root.loadingText = "获取数据失败";
						}

					},function(){

						root.isLoading = true;
						root.loadingText = "网络连接错误";
					})
					this.data[this.index].pageData.currPage++;
				}


				//普通load
				if(this.data[this.index].inload && !this.data[this.index].inloaded){
					this.data[this.index].inloaded = true;
					API[this.data[this.index].api]({
						PageSize : 50,
						currPage : 0
					},function(data){

						if(data.code == 0){
							for(var i=0; i<data.data[0].length; i++){
								root.data[root.index].children.push({
									name : data.data[0][i][root.data[root.index].key],
									code : data.data[0][i][root.data[root.index].code],
									key : data.data[0][i][root.data[root.index].key]
								});
							}

						}else{
							root.isLoading = false;
							root.loadingText = "获取数据失败";
						}

					},function(){
						root.isLoading = true;
						root.loadingText = "网络连接错误";
					})
				}

			},
			clickChange : function(){

			},
			active : function(index){
				return index == this.index;
			},
			cancelMethods : function(){
				this.cancel();

				/*
				this.issearch = false;
				this.intime = false;
				for(var i=0; i<this.data.length; i++){
					for(var j=0; j<this.data[i].children.length; j++){
						this.data[i].children[j].checked = false;
					}
				}

				/*
				//重置默认值
				this.index = 0;
				this.erdata = this.data[0].children;
				this.activeer = 0;
				this.scrollTop = 0;
				this.activeBox = [];

				this.myScroll1.scrollTo(0,0,0);
				this.myScroll2.scrollTo(0,0,0);


				if(this.data[0].input){
					this.issearch = true;
				}else{
					this.issearch = false;
				}

				if(this.data[0].intime){
					this.intime = true;
				}else{
					this.intime = false;
				}

				if(this.data[0].inscroll){
					this.inscroll = true;
				}else{
					this.inscroll = false;
				}

				*/


			},
			submitMethods : function(){

				var filter = [];
				/*
				this.issearch = false;
				this.intime = false;
				*/
				for(var i=0; i<this.data.length; i++){
					var gh = {
						name : this.data[i].name,
						code : this.data[i].code,
						key : this.data[i].key,
						children : []
					}

					for(var g=0; g<this.data[i].children.length; g++){
						if(this.data[i].children[g].checked && this.data[i].children[g].name != "全部"){
							gh.children.push(this.data[i].children[g]);
						}
					}

					if(gh.children.length > 0){
						filter.push(gh)
					}
				}
				this.submit(filter)
				document.documentElement.scrollTop = document.body.scrollTop = 0;
				/*
				for(var i=0; i<this.data.length; i++){
					for(var j=0; j<this.data[i].children.length; j++){
						this.data[i].children[j].checked = false;
					}
				}

				/*
				//重置默认值
				this.index = 0;
				this.erdata = this.data[0].children;
				this.activeer = 0;
				this.scrollTop = 0;
				this.activeBox = [];

				if(this.data[0].input){
					this.issearch = true;
				}else{
					this.issearch = false;
				}

				if(this.data[0].intime){
					this.intime = true;
				}else{
					this.intime = false;
				}

				if(this.data[this.index].inscroll){
					this.inscroll = true;
				}else{
					this.inscroll = false;
				}

				 this.myScroll1.scrollTo(0,0,0);
				 this.myScroll2.scrollTo(0,0,0);
				*/

			},
			activeMethods : function(index){
				var newObj = [];
				for(var j=0; j<this.data[this.index].children.length; j++){
					var hh = this.data[this.index].children[j];
					hh.checked = false;
					newObj.push(hh);
				}
				newObj[index].checked = true;
				this.data[this.index].children = newObj;
				this.erdata = this.data[this.index].children;

				this.activeBox = [];
				for(var h=0; h<this.data.length; h++){
					for(var g=0; g<this.data[h].children.length; g++){
						if(this.data[h].children[g].checked && this.data[h].children[g].name != "全部"){
                            var obj = this.data[h].children[g];
                            obj.index = [h,g];
							this.activeBox.push(obj);
						}
					}
				}

			},
			clearKeyWorkd : function(){
				this.activeBox = [];
				for(var h=0; h<this.data.length; h++){
					for(var g=0; g<this.data[h].children.length; g++){
						this.data[h].children[g].checked = false;
					}
				}
			},
			appendKeyword : function(){
				if(this.nowinput.replace(/^\s+/g,"").replace(/\s+$/g,"") == ''){
					return;
				}
				if(this.data[this.index].input){
					for(var j=0; j<this.data[this.index].children.length; j++){
						this.data[this.index].children[j].checked = false;
					}

					this.data[this.index].children.push({
						name : this.nowinput,
						key : 0,
						code : 0,
						checked : true
					})

					this.activeBox = [];
					for(var h=0; h<this.data.length; h++){
						for(var g=0; g<this.data[h].children.length; g++){
							if(this.data[h].children[g].checked && this.data[h].children[g].name != "全部"){
                                var obj = this.data[h].children[g];
                                obj.index = [h,g];
								this.activeBox.push(obj);
							}
						}
					}

					this.nowinput = "";

				}else{
					this.console.log("非法添加");
				}
			},
			appendTimeword : function(){
				if(this.data[this.index].intime){

					if(this.nowinputtime == ""){
						this.console.log("时间格式错误");
						return;
					}

					for(var j=0; j<this.data[this.index].children.length; j++){
						this.data[this.index].children[j].checked = false;
					}

					this.data[this.index].children.push({
						name : rose.util.getPhoneTime(this.nowinputtime), //new Date(.replace(/[T|+]/,' ') || '').getFullTime(),//new Date(this.nowinputtime).Format('yyyy-MM-dd hh:mm:ss'),
						key : 0,
						code : 0,
						checked : true
					})

					this.activeBox = [];
					for(var h=0; h<this.data.length; h++){
						for(var g=0; g<this.data[h].children.length; g++){
							if(this.data[h].children[g].checked && this.data[h].children[g].name != "全部"){
								var obj = this.data[h].children[g];
								obj.index = [h,g];
								this.activeBox.push(this.data[h].children[g]);
							}
						}
					}

					// this.nowinputtime = "";

				}else{
					this.console.log("非法添加");
				}
			},
            deleteFilterData : function (value,index) { //筛选单个删除
                // this.activeBox = [];

                this.data[value.index[0]].children[value.index[1]].checked = false;
                this.activeBox.splice(index,1);
            },


            chouseLayerTime: function () {

            }
		},
		mounted : function(){

			if(this.data[this.index].input){
				this.issearch = true;
			}else{
				this.issearch = false;
			}

			if(this.data[this.index].intime){
				this.intime = true;
			}else{
				this.intime = false;
			}

			if(this.data[this.index].inscroll){
				this.inscroll = true;

				if(!this.data[this.index].pageData){
					this.data[this.index].pageData = {
						currPage : 0,
						PageSize : 10
					}
				}

			}else{
				this.inscroll = false;
			}


			//普通load
			if(this.data[this.index].inload){
				this.data[this.index].inloaded = true;
				API[this.data[this.index].api]({},function(data){

					if(data.code == 0){
						for(var i=0; i<data.data[0].length; i++){
							root.data[root.index].children.push({
								name : data.data[0][i][root.data[root.index].key],
								code : data.data[0][i][root.data[root.index].code],
								key : data.data[0][i][root.data[root.index].key]
							});
						}

					}else{
						root.isLoading = false;
						root.loadingText = "获取数据失败";
					}

				},function(){
					root.isLoading = true;
					root.loadingText = "网络连接错误";
				})
			}



			for(var i=0; i<this.data.length; i++){
				for(var j=0; j<this.data[i].children.length; j++){
					this.data[i].children[j].checked = false;
				}
			}
			this.erdata = this.data[this.index].children;
			var root = this;

			if(this.data[this.index].pageData && this.data[this.index].pageData.currPage == 0){
				API[this.data[this.index].api](this.data[this.index].pageData,function(data){

					if(data.code == 0){
						for(var i=0; i<data.data[0].length; i++){
							root.data[root.index].children.push({
								name : data.data[0][i][root.data[root.index].key]
							});
						}

						if(data.pageBean.pageCurr+1 >= data.pageBean.pageCount){
							root.data[root.index].loadingText = "没有更多数据了";
							root.data[root.index].toLoading = false;
							root.data[root.index].inscroll = false;
						}else{
							root.data[root.index].isLoading = false;
						}

					}else{
						root.isLoading = false;
						root.loadingText = "获取数据失败";
					}

				},function(){

					root.isLoading = true;
					root.loadingText = "网络连接错误";
				})
				this.data[this.index].pageData.currPage++;
			}

			var config = {

			}
			this.myScroll1 = new iScroll(this.id1,config);
			this.myScroll2 = new iScroll(this.id2,{
				topOffset : 0,
				onScrollMove : function(){
					if(this.distY <= -40 && this.absStartY <= this.maxScrollY && root.inscroll){
						root.nowRotate = Math.abs(this.distY + 40)*1.2;
					}
				},
				onTouchEnd : function(){
					if(this.distY <= -60 && this.absStartY <= this.maxScrollY && root.inscroll){
						console.log('下拉刷新')




						if(root.data[root.index].inscroll && !root.toLoading){
							root.loadingText = "加载中...";
							API[root.data[root.index].api](root.data[root.index].pageData,function(data){

								if(data.code == 0){
									for(var i=0; i<data.data[0].length; i++){
										root.data[root.index].children.push({
											name : data.data[0][i][root.data[root.index].key]
										});
									}

									if(data.pageBean.pageCurr >= data.pageBean.pageCount){
										root.data[root.index].loadingText = "没有更多数据了";
										root.toLoading = false;
										root.data[root.index].inscroll = false;
									}else{
										root.isLoading = false;
										root.toLoading = false;
									}

								}else{
									root.isLoading = false;
									root.loadingText = "获取数据失败";
								}
								root.data[root.index].pageData.currPage++;
							},function(){
								root.isLoading = true;
								root.toLoading = false;
								root.loadingText = "网络连接错误";
							})
						}
						root.nowRotate = 0;
						root.isLoading = true;
						root.toLoading = true;

						setTimeout(function(){
							root.myScroll2.refresh();
						},1)

					}
				}
			});

            root.nowinputtime = new Date().getFullTime();
            laydate.render({
                elem: '#test5'
                ,type: 'datetime',
                value: root.nowinputtime,
                done: function(value, date){
                	root.nowinputtime = value;
                }
            });
		},


		template : '\
			<div class="filter-box ani500ms">\
				<div class="filter-title">\
					<span class="filter-name" v-show="activeBox.length == 0">筛选</span>\
					<span class="filter-clear-button iconfont icon-guanbi1" v-show="activeBox.length > 0" v-on:touchstart="clearKeyWorkd"></span>\
					<div class="fliter-value-wrap">\
						<span class="filter-object" v-for="(x,index) in activeBox">\
							{{x.name}}\
							<span class="filter-object-close" @click="deleteFilterData(x,index)">\
								<span class="iconfont icon-guanbi"></span>\
							</span>\
						</span>\
					</div>\
					\
				</div>\
				<div class="left-filter-box auto-scroll" v-bind:id="id1">\
					<div class="iscrollwrap"><div class="filter-chouse-item ui-nowrap" v-for="(value,key) in data" v-html="value.name" v-on:click="changeMethods(key)" v-bind:class="{active:active(key)}"></div></div>\
				</div>\
				<div class="right-filter-box auto-scroll" v-bind:id="id2">\
					<div class="iscrollwrap">\
						<div class="filter-chouse-item ui-nowrap" v-for="(value,key) in erdata" @click="activeMethods(key)" v-bind:class="{active : value.checked}">\
							<span v-html="value.name"></span>\
							<span class="iconfont icon-xuanzhong chouseme"></span>\
						</div>'

						+"<div class=\"filter-load-more-setting\" v-show=\"isLoading\">\
							{{loadingText}}\
							<span v-show=\"toLoading\" style=\"display:inline-block;font-size:.5rem;\" class=\"iconfont icon-shuaxin\" ></span>\
						  </div>  \
						  <div class=\"filter-load-more\" v-show=\"inscroll && !isLoading\">  <p> <span style=\"display:block;font-size:.5rem;\" class=\"iconfont icon-shuaxin\" v-bind:style=\"{  'transform' : 'rotateZ('+nowRotate+'deg)' }\" ></span></p> <p>松开加载更多</p> </div>\n"+
						'\
					</div>\
				</div>\
				<div class="filter-add" v-show="issearch">\
					<input type="text" placeholder="添加查询条件" v-model="nowinput" maxlength="30"/><button href="javascript:;" class="btn-filter-add" @click="appendKeyword">添加</button>\
				</div>\
				<div class="filter-add" v-show="intime" style="position: relative;">\
				    <div id="test5" style="height: .8rem;line-height: .8rem;    border: 1px solid #efefef;    border-radius: 4px;background-color: #fff; text-indent: .4rem; width: 70%;position: absolute;"></div>\
					<input type="text" @click.prevent="chouseLayerTime" v-model="nowinputtime"/><button href="javascript:;" class="btn-filter-add" @click="appendTimeword">添加</button>\
				</div>\
				<div class="filter-button">\
					<a href="javascript:;" class="filter-button-object fl btn-active1" @click="cancelMethods">取消</a>\
					<a href="javascript:;" class="filter-button-object fr btn-active1" @click="submitMethods">确认</a>\
				</div>\
			</div>\
			    '
	})



	Vue.prototype.filterOpen = function(){
		var root = this;
		this.filterActive = true;
		this.closeFilter = this.console.shadow(0.8,true,function(){
			root.filterActive = false;
			rose.util.runScroll();
		});
		rose.util.stopScroll();
	}
	Vue.prototype.filterClose = function(){
		this.closeFilter();
		this.filterActive = false;
		rose.util.runScroll();
	}



	/*
		新页面组件
		详细使用见 https://github.com/Jon-Millent/workspace/blob/master/txerp-copy/api.MD#结构
	 */

	Vue.component('ui-page',{
		props : {
			close : {
				default : function(){},
				type : Function
			},
			title : {
				default : "返回"
			}
		},
		data : function(){
			return {
				time : new Date().getTime()
			}
		},
		methods : {
			titleBack : function(){
				this.$emit('close',this.show);
			}
		},
		mounted : function(){

			/*
				var obj = document.getElementById(this.getId);

				function stopPropagation(e){
					e.preventDefault();
				}

				function setView(e){
					if(obj.scrollHeight == obj.clientHeight){
						obj.addEventListener('touchstart',stopPropagation);
					}else{
						obj.removeEventListener('touchstart',stopPropagation);
					}

					console.log('ssss<-----',e)
				}
				setView();
				document.getElementById(this.getId2).addEventListener('resize',setView);
			*/

		},
		computed : {
			getId : function(){
				return 'full'+this.time;
			},
			getId2 : function(){
				return 'full-child'+this.time;
			}
		},
		template : '\
			<div class="full-page" :id="getId">\
				<div class="full-header">\
					<header class="ui-header ui-header-positive ui-border-b header-theme2 header-theme3 nobutton">\
			            <i class="iconfont icon-back" @click="titleBack"></i>\
			            <h1><span @click="titleBack">{{title}}</span></h1>\
			            <div class="ui-btn"><slot name="button"><slot></div>\
			        </header>\
			        <slot name="header"></slot>\
				</div>\
				<div class="full-content" :id="getId2">\
					<slot name="content"></slot>\
				</div>\
				<div class="full-footer">\
					<slot name="footer"></slot>\
				</div>\
			</div>\
			'
	})





	Vue.prototype.openPage = function(link){
		document.location.href = link;
	}
	Vue.prototype.yanzheng = function(obj){
		if(!obj){
			return '';
		}
		if((obj.$touched || obj.$submitted) && obj.$valid){
			return 'has-success';
		}
		if((obj.$touched || obj.$submitted) && obj.$invalid){
			return 'has-error';
		}
	}
	Vue.prototype.getTime = function(obj){
		var time = "";
		try{
			time = obj.time || obj;
		}catch(e){}
		return time ? new Date(time).Format('yyyy-MM-dd hh:mm:ss') : "/";
	}
	Vue.prototype.getDay = function(obj){

		var time = "";
		try{
			time = obj.time || obj;
		}catch(e){}

		return time ?  new Date(parseInt(time)).Format('yyyy-MM-dd') : time;
	}
	Vue.prototype.getToday = function(obj){
		if (new Date(parseInt((obj.time || time))).toDateString() === new Date().toDateString()) {

			return '今天';
		}
		return new Date(parseInt(obj.time || time)).Format('yyyy-MM-dd');
	}
	Vue.prototype.toDataArray = function(arr,key){
		var betaTime = {};
		var jArray = [];

		for(var i=0; i<arr.length; i++){
			var gKey = new Date(new Date(arr[i][key].time).toDateString()).getTime();

			if(betaTime[gKey]){
				betaTime[gKey].push(arr[i])
			}else{
				betaTime[gKey] = [];
				betaTime[gKey].push(arr[i]);
			}
		}

		for(var i in betaTime){
			jArray.push({
				time : i,
				children : betaTime[i]
			})
		}
		return jArray;
	}

	Vue.prototype.getPling = function(code){
		// return code==0?'自卸':code==1?'泵送':code==2?'塔吊':'未知'
		return ['自卸','泵送','塔吊'][code] || '未知';
	}
    Vue.prototype.noData = "/"
    Vue.prototype.isWeixin = function () {
        var ua = window.navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i) == 'micromessenger'){
            return true;
        }else{
            return false;
        }
    }
    Vue.prototype.isAPP = function () {
        var isTrue = true;
        window.device = "";

        window.appinit = function () {
            window.device = "app";
        }
        try{
            javascript:tool.initApp();
        }catch(error){
            isTrue = false;
        }

        return isTrue;
    }



})(Vue,window);





!function(){"use strict";function t(e,o){function i(t,e){return function(){return t.apply(e,arguments)}}var r;if(o=o||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=o.touchBoundary||10,this.layer=e,this.tapDelay=o.tapDelay||200,this.tapTimeout=o.tapTimeout||700,!t.notNeeded(e)){for(var a=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],c=this,s=0,u=a.length;u>s;s++)c[a[s]]=i(c[a[s]],c);n&&(e.addEventListener("mouseover",this.onMouse,!0),e.addEventListener("mousedown",this.onMouse,!0),e.addEventListener("mouseup",this.onMouse,!0)),e.addEventListener("click",this.onClick,!0),e.addEventListener("touchstart",this.onTouchStart,!1),e.addEventListener("touchmove",this.onTouchMove,!1),e.addEventListener("touchend",this.onTouchEnd,!1),e.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(e.removeEventListener=function(t,n,o){var i=Node.prototype.removeEventListener;"click"===t?i.call(e,t,n.hijacked||n,o):i.call(e,t,n,o)},e.addEventListener=function(t,n,o){var i=Node.prototype.addEventListener;"click"===t?i.call(e,t,n.hijacked||(n.hijacked=function(t){t.propagationStopped||n(t)}),o):i.call(e,t,n,o)}),"function"==typeof e.onclick&&(r=e.onclick,e.addEventListener("click",function(t){r(t)},!1),e.onclick=null)}}var e=navigator.userAgent.indexOf("Windows Phone")>=0,n=navigator.userAgent.indexOf("Android")>0&&!e,o=/iP(ad|hone|od)/.test(navigator.userAgent)&&!e,i=o&&/OS 4_\d(_\d)?/.test(navigator.userAgent),r=o&&/OS [6-7]_\d/.test(navigator.userAgent),a=navigator.userAgent.indexOf("BB10")>0;t.prototype.needsClick=function(t){switch(t.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(t.disabled)return!0;break;case"input":if(o&&"file"===t.type||t.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return/\bneedsclick\b/.test(t.className)},t.prototype.needsFocus=function(t){switch(t.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!n;case"input":switch(t.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!t.disabled&&!t.readOnly;default:return/\bneedsfocus\b/.test(t.className)}},t.prototype.sendClick=function(t,e){var n,o;document.activeElement&&document.activeElement!==t&&document.activeElement.blur(),o=e.changedTouches[0],n=document.createEvent("MouseEvents"),n.initMouseEvent(this.determineEventType(t),!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,0,null),n.forwardedTouchEvent=!0,t.dispatchEvent(n)},t.prototype.determineEventType=function(t){return n&&"select"===t.tagName.toLowerCase()?"mousedown":"click"},t.prototype.focus=function(t){var e;o&&t.setSelectionRange&&0!==t.type.indexOf("date")&&"time"!==t.type&&"month"!==t.type?(e=t.value.length,t.setSelectionRange(e,e)):t.focus()},t.prototype.updateScrollParent=function(t){var e,n;if(e=t.fastClickScrollParent,!e||!e.contains(t)){n=t;do{if(n.scrollHeight>n.offsetHeight){e=n,t.fastClickScrollParent=n;break}n=n.parentElement}while(n)}e&&(e.fastClickLastScrollTop=e.scrollTop)},t.prototype.getTargetElementFromEventTarget=function(t){return t.nodeType===Node.TEXT_NODE?t.parentNode:t},t.prototype.onTouchStart=function(t){var e,n,r;if(t.targetTouches.length>1)return!0;if(e=this.getTargetElementFromEventTarget(t.target),n=t.targetTouches[0],o){if(r=window.getSelection(),r.rangeCount&&!r.isCollapsed)return!0;if(!i){if(n.identifier&&n.identifier===this.lastTouchIdentifier)return t.preventDefault(),!1;this.lastTouchIdentifier=n.identifier,this.updateScrollParent(e)}}return this.trackingClick=!0,this.trackingClickStart=t.timeStamp,this.targetElement=e,this.touchStartX=n.pageX,this.touchStartY=n.pageY,t.timeStamp-this.lastClickTime<this.tapDelay&&t.preventDefault(),!0},t.prototype.touchHasMoved=function(t){var e=t.changedTouches[0],n=this.touchBoundary;return Math.abs(e.pageX-this.touchStartX)>n||Math.abs(e.pageY-this.touchStartY)>n?!0:!1},t.prototype.onTouchMove=function(t){return this.trackingClick?((this.targetElement!==this.getTargetElementFromEventTarget(t.target)||this.touchHasMoved(t))&&(this.trackingClick=!1,this.targetElement=null),!0):!0},t.prototype.findControl=function(t){return void 0!==t.control?t.control:t.htmlFor?document.getElementById(t.htmlFor):t.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},t.prototype.onTouchEnd=function(t){var e,a,c,s,u,l=this.targetElement;if(!this.trackingClick)return!0;if(t.timeStamp-this.lastClickTime<this.tapDelay)return this.cancelNextClick=!0,!0;if(t.timeStamp-this.trackingClickStart>this.tapTimeout)return!0;if(this.cancelNextClick=!1,this.lastClickTime=t.timeStamp,a=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,r&&(u=t.changedTouches[0],l=document.elementFromPoint(u.pageX-window.pageXOffset,u.pageY-window.pageYOffset)||l,l.fastClickScrollParent=this.targetElement.fastClickScrollParent),c=l.tagName.toLowerCase(),"label"===c){if(e=this.findControl(l)){if(this.focus(l),n)return!1;l=e}}else if(this.needsFocus(l))return t.timeStamp-a>100||o&&window.top!==window&&"input"===c?(this.targetElement=null,!1):(this.focus(l),this.sendClick(l,t),o&&"select"===c||(this.targetElement=null,t.preventDefault()),!1);return o&&!i&&(s=l.fastClickScrollParent,s&&s.fastClickLastScrollTop!==s.scrollTop)?!0:(this.needsClick(l)||(t.preventDefault(),this.sendClick(l,t)),!1)},t.prototype.onTouchCancel=function(){this.trackingClick=!1,this.targetElement=null},t.prototype.onMouse=function(t){return this.targetElement?t.forwardedTouchEvent?!0:t.cancelable&&(!this.needsClick(this.targetElement)||this.cancelNextClick)?(t.stopImmediatePropagation?t.stopImmediatePropagation():t.propagationStopped=!0,t.stopPropagation(),t.preventDefault(),!1):!0:!0},t.prototype.onClick=function(t){var e;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===t.target.type&&0===t.detail?!0:(e=this.onMouse(t),e||(this.targetElement=null),e)},t.prototype.destroy=function(){var t=this.layer;n&&(t.removeEventListener("mouseover",this.onMouse,!0),t.removeEventListener("mousedown",this.onMouse,!0),t.removeEventListener("mouseup",this.onMouse,!0)),t.removeEventListener("click",this.onClick,!0),t.removeEventListener("touchstart",this.onTouchStart,!1),t.removeEventListener("touchmove",this.onTouchMove,!1),t.removeEventListener("touchend",this.onTouchEnd,!1),t.removeEventListener("touchcancel",this.onTouchCancel,!1)},t.notNeeded=function(t){var e,o,i,r;if("undefined"==typeof window.ontouchstart)return!0;if(o=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!n)return!0;if(e=document.querySelector("meta[name=viewport]")){if(-1!==e.content.indexOf("user-scalable=no"))return!0;if(o>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(a&&(i=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/),i[1]>=10&&i[2]>=3&&(e=document.querySelector("meta[name=viewport]")))){if(-1!==e.content.indexOf("user-scalable=no"))return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}return"none"===t.style.msTouchAction||"manipulation"===t.style.touchAction?!0:(r=+(/Firefox\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1],r>=27&&(e=document.querySelector("meta[name=viewport]"),e&&(-1!==e.content.indexOf("user-scalable=no")||document.documentElement.scrollWidth<=window.outerWidth))?!0:"none"===t.style.touchAction||"manipulation"===t.style.touchAction?!0:!1)},t.attach=function(e,n){return new t(e,n)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return t}):"undefined"!=typeof module&&module.exports?(module.exports=t.attach,module.exports.FastClick=t):window.FastClick=t}();

if ('addEventListener' in document) {
    document.addEventListener('DOMContentLoaded', function() {
        FastClick.attach(document.body);
    }, false);
}